package com.sang.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Arrays;

//在templates目录下的所有页面，只能通过Controller来跳转
//这个需要模板引擎的支持！thymeleaf
@Controller
public class IndexController {

    @RequestMapping("/index")
    public String index() {
        return "hello";
    }

    @RequestMapping("/t1")
    public String hello(Model model) {
        model.addAttribute("msg","helloSpringBoot");
        model.addAttribute("msg1","<h1>helloSpringBoot</h1>");
        model.addAttribute("users", Arrays.asList("qinjiang","kuangshen"));
        return "hello";
    }

}
